home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / pc / pr42sdk / examples / projects / afilter / fl-lfill.c next >
C/C++ Source or Header  |  1995-10-07  |  2KB  |  83 lines

  1. //=============================================================================
  2. //
  3. // Fl-lfill.c - Audio filter plug-in.
  4. //
  5. // Part of the Adobe Premiere 4.2 Plug-in Developer's Toolkit.
  6. //
  7. // Copyright 1993-96, Adobe Systems Incorporated, all rights reserved worldwide.
  8. //
  9. // Written by Nick Schlott.
  10. //
  11. // 1.00        1/25/94        njs        Original version.
  12. // 1.02        1/9/96        ba        Updated for Premiere 4.2 and MSVC++ 2.2 & 4.2.
  13. //
  14. //-----------------------------------------------------------------------------
  15.  
  16. #include <windows.h>
  17.  
  18. #include "Compat.h" 
  19. #include "Premiere.h"
  20.  
  21. #define gaStereo 0x0100
  22. #define ga16Bit     0x0200
  23.  
  24.  
  25. BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
  26. {
  27.     switch (dwReason)
  28.     {
  29.         case DLL_PROCESS_ATTACH:
  30.             break;
  31.  
  32.         case DLL_THREAD_ATTACH:
  33.             break;
  34.  
  35.         case DLL_THREAD_DETACH:
  36.             break;
  37.  
  38.         case DLL_PROCESS_DETACH:
  39.             break;
  40.     }
  41.     return(TRUE);
  42. }
  43.  
  44.  
  45. //-----------------------------------------------------------------------------
  46. // Perform the effect
  47.  
  48. short PRMEXPORT xFilter (short selector, AudioFilter theData)
  49. {
  50.     short            result = 0, flags, *wdest;
  51.     unsigned char    *dest, *src;
  52.     long            count, i;
  53.  
  54.     switch (selector)
  55.     {
  56.         case fsExecute:
  57.             src = (*theData)->source;
  58.             dest = (*theData)->destination;    // destination buffer
  59.             count = (*theData)->samplecount;
  60.             flags = (*theData)->flags;
  61.             
  62.             memcpy(dest,(*theData)->source,count);
  63.             
  64.             if (flags & gaStereo)
  65.             {
  66.                 if (flags & ga16Bit)
  67.                 {
  68.                     wdest = (short*)dest;
  69.                     count >>= 1;
  70.                     for (i=1; i<count; i+=2)
  71.                         wdest[i] = 0x0000;
  72.                 }
  73.                 else
  74.                 {
  75.                     for (i=1; i<count; i+=2)
  76.                         dest[i] = 0x80;
  77.                 }
  78.             }
  79.             break;
  80.     }
  81.     return(result);
  82. }
  83.